In [1]:
# this line imports several useful function (including imshow)
%pylab inline
In [2]:
# import OpenCV
import cv, cv2
In [3]:
episode1 = '/vol/corpora4/tvseries/tvd/GameOfThrones/dvd/rip/video/GameOfThrones.Season01.Episode01.mkv'
capture = cv2.VideoCapture(episode1)
In [4]:
for i in range(1700):
_, bgr = capture.read()
In [5]:
print "Behind the wall..."
imshow(bgr);
In [6]:
print "... it's actually cold!"
rgb = cv2.cvtColor(bgr, cv.CV_BGR2RGB)
imshow(rgb);
In [7]:
frameNumber = int(capture.get(cv.CV_CAP_PROP_POS_FRAMES))
currentTime = float(capture.get(cv.CV_CAP_PROP_POS_MSEC)) / 1000
print "Frame = #%d / Time = %.3fs" % (frameNumber, currentTime)